<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>

<div id="app">

    <p>
        {{count}}
    </p>
    <button @click="add(123)">+</button>
    <button @click="sub(321)">-</button>
    <button @click="clickaa('asdas',$event)">点我</button>

    <div @click="clickdiv">
        我要冒泡
        <button @click.stop="clickbtn">点我</button>
    </div>

    <form action="http://baidu.com">
        阻止默认事件
        <button type="submit" @click.prevent="submit">提交</button>
    </form>

    <input type="text" @keyup.enter="keyup">

    <button type="submit" @click.once="once">点击一次</button>

</div>
<script src="../js/vue.js"></script>
<script>
    const app = new Vue({
        el: '#app',
        data: {
            messge: '这是信息',
            count: 9
        },
        methods: {
            once() {
                console.log('once');
            },
            keyup() {
                console.log('keyup');
            },
            submit() {
                console.log('submit');
            },
            clickdiv() {
                console.log('clickdiv');
            },
            clickbtn() {
                console.log('clickbtn');
            },
            add(can) {
                console.log(can);
                this.count = ++this.count
            },
            sub(can) {
                console.log(can);
                this.count = --this.count
            },
            clickaa(acb, evet) {
                console.log(acb);
                console.log(evet);
            }
        }

    })
</script>

</body>
</html>